/* 
   品牌管理相关的接口请求函数
*/
import request from "@/utils/request";
import type {
  trademarkdItemModel,
  trademarkdListModel,
  trademarkdPageListModel,
} from "./model/trademarkdModel";

//使用枚举来封装接口path
enum ApiPath {
  // GET /admin/product/baseTrademark/{page}/{limit}
  getTrademarkdPageList = "/admin/product/baseTrademark",
  // POST /admin/product/baseTrademark/save
  addTrademarkdList = "/admin/product/baseTrademark/save",
  // PUT /admin/product/baseTrademark/update
  putTrademarkdList = "/admin/product/baseTrademark/update",
  // DELETE /admin/product/baseTrademark/remove/{id}
  deleteTrademarkdList = "/admin/product/baseTrademark/remove",
  //GET /admin/product/baseTrademark/getTrademarkList
  getAllTrademarkList = "/admin/product/baseTrademark/getTrademarkList",
}

//获取品牌分页列表
export const getTrademarkdPageListApi = (page: number, limit: number) => {
  return request.get<any, trademarkdPageListModel>(
    ApiPath.getTrademarkdPageList + `/${page}/${limit}`
  );
};
//获取所有品牌列表
export const getAllTrademarkListApi = () => {
  return request.get<any, trademarkdListModel>(ApiPath.getAllTrademarkList);
};
//添加品牌
export const postAddTrademarkdListApi = (
  trademarkdItem: trademarkdItemModel
) => {
  return request.post(ApiPath.addTrademarkdList, trademarkdItem);
};
//修改品牌
export const putTrademarkdListApi = (trademarkdItem: trademarkdItemModel) => {
  return request.put(ApiPath.putTrademarkdList, trademarkdItem);
};
//删除品牌
export const deleteTrademarkdListApi = (id: number) => {
  return request.delete(ApiPath.deleteTrademarkdList + `/${id}`);
};
